package QC.MessageBox.beans.wbmsg.back;

import io.vertx.core.json.Json;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;

/**
 * Created by Andaren on 2017/6/29.
 * Used for: 图文回复
 */
public class WBArticlesMsg {

    private List<WBArticle> articleList;

    public List<WBArticle> getArticleList() {
        return articleList;
    }

    public WBArticlesMsg setArticleList(List<WBArticle> articleList) {
        this.articleList = articleList;
        return this;
    }

    public String toJsonString() {
        JsonObject articleJson = new JsonObject();
        JsonArray articles = new JsonArray();
        for (WBArticle article : articleList) {
            articles.add(JsonObject.mapFrom(article));
        }
        articleJson.put("articles", articles);

        return articleJson.encode();
    }
}
